<template>
    <header class="pub-head">
        <div class="head-box" v-bind:style="{backgroundColor: bgColor}" :class="{'head-red':themeColor=='true','bottom-border':isBorder=='true'}">
            <div class="left" @click="back">
                <span class="line line1" :style="{backgroundColor: leftColor}"></span>
                <span class="line line2" :style="{backgroundColor: leftColor}"></span>
            </div>
            <div class="title" :style="{color: titleColor}">{{title}}</div>
            <div class="right flexc" :style="{color: rightColor, fontSize: rightSize}">
                <slot></slot>
            </div>
        </div>
    </header>
</template>

<script>
export default {
    data () {
        return {
            bgcor: this.bgColor
        }
    },
    
    props: {
        // 头部标题
        title: {
            type: String,
            default: '标题'
        },
        titleColor: {
            type: String,
            default: '#333'
        },
        // 头部背景色
        bgColor: {
            type: String,
            default: '#fff'
        },
        bgchange: {

        },
        // 头部主题色
        themeColor: {
            type: String,
            default: 'false'
        },
        // 左边图标颜色
        leftColor: {
            type: String,
            default: '#333'
        },
        // 右边文字尺寸
        rightSize: {
            type: String,
            default: '0.26rem'
        },
        // 右边文字颜色
        rightColor: {
            type: String,
            default: '#333'
        },
        // 边框
        isBorder: {
            type: String,
            default: 'true'
        },
        
    },

    methods: {
        // 返回上一页
        back() {
            this.$router.go(-1);
        }
    }
}
</script>

<style lang="less" scoped>
 @import url('../style/mixin');
    .pub-head {
        width: 100%;
        height: 0.88rem;
        .head-box {
            position: fixed;
            top: 0;
            width: 100%;
            max-width: 750px;
            height: 0.88rem;
            z-index: 99;
            .left {
                position: absolute;
                left: 0;
                top: 0;
                width: 0.88rem;
                height: 0.88rem;
                .line {
                    content: "";
                    position: absolute;
                    top: 50%;
                    left: 0.32rem;
                    width: 0.24rem;
                    height: 1px;
                    background-color: #333;
                }
                .line1 {
                    margin-top: -0.08rem;
                    transform: rotate(-45deg);
                }
                .line2 {
                    margin-top: 0.08rem;
                    transform: rotate(45deg);
                }
            }
            .title {
                width: 100%;
                height: 100%;
                line-height: 0.88rem;
                text-align: center;
                font-size: 0.36rem;
            }
            .right {
                position: absolute;
                right: 0;
                top: 0;
                height: 0.88rem;
                padding: 0 .25rem;
            }
        }
        // 主题色
        .head-red {
            .bg-cor-ltr(#36a9eb, #3c93ea);
        }
        .seat {
            height: 0.88rem;
        }    
        .bottom-border {
            border-bottom: 1px solid #ededed;
        }
    }
</style>
